<template>
  <div class="all">
    <head-layout/>
    <!--    头部-->
    <div class="banner">
      <img src="@/assets/YNU.jpg">
      <div class="line"></div>
      <div class="sname">
        <span>{{ Course.name }}</span>
        <span class="type">{{ Course.description }}</span>
        <p>{{ Course.teacher }}</p>
      </div>
      <el-button round><el-icon><Clock /></el-icon>我的学习时长</el-button>
    </div>

    <div class="middle">
      <!--      导航-->
      <TeacherSide/>
      <!--      具体内容-->
      <div class="right">
        <div>
          <h2  style="font-family: '宋体',sans-serif;text-align: center;margin-top: 30px">实验名称  {{ neirong.name }}</h2>
          <p style="font-family: 宋体,sans-serif;font-size: 18px;">实验要求: {{neirong.content}}</p>
          <div style="margin-top: 20px">
            <span>开放时间:&nbsp;  </span> <span>{{ neirong.creatTime }} <br/></span>
            <span>截止时间:&nbsp; </span> <span>{{ neirong.deadline }}<br/></span>
            <h4 style="padding-top:10px">提交详情：</h4>
          </div>
        </div>
        <ExpDetail/>
        <el-empty description="没有东西啦"></el-empty>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import {
  Clock,
} from '@element-plus/icons-vue'
import TeacherSide from "@/components/teacher/TeacherSide.vue";
import ExpDetail from "@/components/teacher/ExpDetail.vue";
import {onMounted, ref} from 'vue'
import {CourseStore, shiyanStore} from "@/store";
import axios from "axios";
import { genFileId } from 'element-plus'
import type { UploadInstance, UploadProps, UploadRawFile } from 'element-plus'
import HeadLayout from "@/components/HeadLayout.vue";

const handleOpen = (key: string, keyPath: string[]) => {
  console.log(key, keyPath)
}
const handleClose = (key: string, keyPath: string[]) => {
  console.log(key, keyPath)
}
const activeIndex2 = ref('1')
const input = ref('')
const handleSelect = (key: string, keyPath: string[]) => {
  console.log(key, keyPath)
}

const upload = ref<UploadInstance>()

const handleExceed: UploadProps['onExceed'] = (files) => {
  upload.value!.clearFiles()
  const file = files[0] as UploadRawFile
  file.uid = genFileId()
  upload.value!.handleStart(file)
}

const submitUpload = () => {
  upload.value!.submit()
}

const value = ref(new Date())
const store = shiyanStore()

const neirong = ref({})
const loadone = () => {
  axios.get('/experiment/'+ store.id)
      .then(function(res){
        neirong.value = res.data.data.data
        console.log(res.data.data.data)
      })
}
const Course = ref({
  name: '',
  description: '',
  teacher: ''
})

const coursestore = CourseStore()
const load_course = () =>{
  axios.get('/course/'+ coursestore.course_id)
      .then(function(res){
        Course.value = res.data.data.data
        console.log(res.data.data)
        axios.get('/teachercourse/findteacher?cid='+coursestore.course_id)
            .then(function(ans){
              Course.value.teacher = ans.data.data[0].name
              console.log(ans.data.data)
              console.log(ans.data.data[0].name)
            })
      })
}

onMounted(async ()=>{
  load_course()
})

onMounted(async () => {
  loadone()
})

</script>

<style scoped>
/*整体布局*/
.all{
  overflow-x: hidden;
  background-color: rgba(240, 242, 245, 1);
}
/*头部*/
.banner{
  background-color: #fff;
  border: 1px solid rgba(0, 21, 41, 0.12);
  padding: 10px 32px;
  /*border-radius: 20px;*/
  width: 100%;
  height: 50px;
  overflow-x: hidden;
  position: relative;
  margin-bottom: 10px;
  margin-top: -10px;
}
.banner img{
  width: 108px;
  height: 40px;
  margin-top: 5px;
  margin-right: 100px;
}
.line{
  background:#CFD3DC;/*背景色为浅灰色*/
  width:0.8px;/*设置宽高*/
  height:45px;
  position:relative;/*调整位置*/
  left: 150px;
  float:left;/*让此div与前面的并排显示*/
}
.all .banner .sname{
  margin-left: 175px;
  margin-top: -40px;
  line-height: 0.6;
}
.all .banner .sname span{
  color: #333333;
  font-size: 18px;
  font-weight: bold;
}
.all .banner .sname .type{
  background-color: #CBA265;
  border-radius: 5px;
  font-weight: normal;
  font-size: 12px;
  color: white;
  /*上右下左*/
  margin-left: 10px;
  padding: 2px 6px;
  vertical-align: middle;
}
.all .banner .sname p{
  color: #00CC7E;
  font-size: 12px;
}
.el-button.is-round{
  position: absolute;
  right: 90px;
  top: 20px;
}
/*下方*/
.middle{
  display: flex;
  /*justify-content: space-between;*/
  width: 100%;
}
.left{
  margin-top: 20px;
  background: #fff;
  width: 300px;
  border-radius: 6px;
  margin-left: 20px;
}
.menu{
  height: 356px;
}
.all .middle .left .menu .el-menu{
  width: 300px;
  border-radius: 6px;
  font-size: 14px;
}
.text{
  height: 300px;
  font-size: small;

}
.right{
  padding-right: 20px;
  padding-left: 20px;
  margin-top: 20px;
  background: #fff;
  width: 100%;
  border-radius: 6px;
  margin-right: 20px;
  margin-left: 20px;
}
.el-divider--horizontal{
  width: 90%;
  margin-left: 5%;
  margin-top: 10px;
}
.text{
  margin-left: 10%;
}

a {
  text-decoration: none;
  color: #666666
}
a.router-link-active{
  color: #00CC7E;
}
.router-link-active {
  text-decoration: none;
  color: #00CC7E;
}

</style>
